#include<iostream>
using namespace std;
#include <iomanip>
#include<cmath>

int measure();
int measure(int a, int b) {
    int temp = 0;
    for (temp = a;; temp--) {
        if (a % temp == 0 && b % temp == 0)
            break;
    }
    return ((a * b / temp) + temp);
}

int  main()
{
    int a, b;
    cin >> a >> b;
    int measure(int a, int b);
    int z = measure(a, b);
    cout << z;



}


